{
  "formId": "InstrumentMaster",
  "entity": "Instrument",
  "title": "Instrument Master",

  "pages": [

    {
      "pageId": "Details",
      "pageName": "Instrument Details",
      "sections": [

        {
          "sectionId": "BasicInfo",
          "sectionName": "Basic Information",
          "layout": { "columns": 12 },
          "fields": [
            {
              "fieldId": "InstrumentName",
              "Name": "InstrumentName",
              "label": "Instrument Name",
              "type": "picklist",
              "IsVisible": true,
              "layout": { "colSpan": 5 }
            },
            {
              "fieldId": "InstrumentType",
              "Name": "InstrumentType",
              "label": "Instrument Type",
              "type": "combobox",
              "FieldType": "combobox",
              "Required": true,
              "PostData": true,
              "DefaultValue": 0,
              "LabelWidth": 132,
              "Width": 300,
              "PickLists": [
                { "key": 0, "value": "Cash" },
                { "key": 1, "value": "Cheque" },
                { "key": 2, "value": "Demand Draft" },
                { "key": 3, "value": "EFT (Electronic Fund Transfer)" },
                { "key": 4, "value": "Gift Voucher" },
                { "key": 5, "value": "Credit Card" },
                { "key": 6, "value": "Debit Card" }
              ],
              "IsVisible": true,
              "layout": { "colSpan": 4 }
            }
          ]
        },

        {
          "sectionId": "PostingConfig",
          "sectionName": "Posting Configuration",
          "layout": { "columns": 12 },
          "fields": [
            {
              "fieldId": "InstrumentAccountPostType",
              "Name": "InstrumentAccountPostType",
              "label": "Posting",
              "type": "radio",
              "FieldType": "radio",
              "DefaultValue": 0,
              "Required": true,
              "PostData": true,
              "LabelWidth": 132,
              "PickLists": [
                { "key": 0, "value": "Immediate" },
                { "key": 1, "value": "On Realisation" },
                { "key": 2, "value": "On Deposit" }
              ],
              "IsVisible": true,
              "layout": { "colSpan": 4 }
            },
            {
              "fieldId": "InstrumentPostDatedType",
              "Name": "InstrumentPostDatedType",
              "label": "Post Dated",
              "type": "radio",
              "FieldType": "radio",
              "DefaultValue": 0,
              "Required": true,
              "PostData": true,
              "LabelWidth": 132,
              "PickLists": [
                { "key": 0, "value": "Not Applicable" },
                { "key": 1, "value": "Immediate" },
                { "key": 2, "value": "On Deposit" },
                { "key": 3, "value": "On Realisation" }
              ],
              "IsVisible": true,
              "layout": { "colSpan": 4 }
            },
            {
              "fieldId": "InstrumentValidityPeriodInDays",
              "Name": "InstrumentValidityPeriodInDays",
              "label": "Validity Days",
              "type": "number",
              "FieldType": "number",
              "Required": true,
              "PostData": true,
              "MaxLength": 4,
              "DefaultValue": 0,
              "LabelWidth": 132,
              "Width": 210,
              "Placeholder": "Enter Days",
              "IsVisible": true,
              "layout": { "colSpan": 4 }
            },
            {
              "fieldId": "InstrumentStatusOfInstrument",
              "Name": "InstrumentStatusOfInstrument",
              "label": "Instrument Status",
              "type": "radio",
              "FieldType": "radio",
              "DefaultValue": 0,
              "Required": true,
              "PostData": true,
              "LabelWidth": 132,
              "Width": 250,
              "PickLists": [
                { "key": 0, "value": "Pending" },
                { "key": 1, "value": "Realisation" }
              ],
              "IsVisible": true,
              "layout": { "colSpan": 4 }
            }
          ]
        }

      ]
    },

    {
      "pageId": "Applicability",
      "pageName": "Applicability",
      "sections": [

        {
          "sectionId": "AppSettings",
          "sectionName": "Applicability Settings",
          "layout": { "columns": 12 },
          "fields": [
            {
              "fieldId": "InstrumentIsApplicableForBank",
              "Name": "InstrumentIsApplicableForBank",
              "label": "Bank Transaction Applicable",
              "type": "checkbox",
              "FieldType": "checkbox",
              "Required": false,
              "PostData": true,
              "DefaultValue": 0,
              "LabelWidth": 132,
              "Width": 300,
              "IsVisible": true,
              "layout": { "colSpan": 4 }
            },
            {
              "fieldId": "InstrumentIsApplicableforCounterTransaction",
              "Name": "InstrumentIsApplicableforCounterTransaction",
              "label": "Counter Transaction Applicable",
              "type": "checkbox",
              "FieldType": "checkbox",
              "Required": false,
              "PostData": true,
              "DefaultValue": 1,
              "LabelWidth": 132,
              "Width": 400,
              "IsVisible": true,
              "layout": { "colSpan": 4 }
            },
            {
              "fieldId": "AccountName",
              "Name": "AccountName",
              "label": "Account",
              "type": "picklist",
              "PicklistJSON": "Account",
              "LinkId": "AccountId",
              "LinkSubTitle": "AccountCode",
              "PicklistTitle": "Name",
              "PicklistSubTitle": "Code",
              "PlaceHolder": "Select Account",
              "Multiple": false,
              "AddNew": false,
              "Required": true,
              "PostData": true,
              "MaxLength": 20,
              "LabelWidth": 132,
              "Width": 360,
              "SubWidth": 160,
              "IsVisible": true,
              "layout": { "colSpan": 6 }
            }
          ]
        },

        {
          "sectionId": "OrgMapping",
          "sectionName": "Organisation Mapping",
          "layout": { "columns": 12 },
          "fields": [
            {
              "fieldId": "InstrumentOuNames",
              "Name": "InstrumentOuNames",
              "label": "OU",
              "type": "picklist",
              "PicklistJSON": "InstrumentOU",
              "LinkId": "InstrumentOuIds",
              "PicklistTitle": "Name",
              "PlaceHolder": "Select OU Names",
              "Multiple": true,
              "AddNew": false,
              "Required": false,
              "PostData": true,
              "MaxLength": 20,
              "LabelWidth": 132,
              "Width": 360,
              "IsVisible": true,
              "layout": { "colSpan": 6 }
            },
            {
              "fieldId": "InstrumentOuGroupNames",
              "Name": "InstrumentOuGroupNames",
              "label": "OU Group",
              "type": "picklist",
              "PicklistJSON": "InstrumentOUGroup",
              "LinkId": "InstrumentOuGroupIds",
              "PicklistTitle": "Name",
              "PlaceHolder": "Select OU Group Names",
              "Multiple": true,
              "AddNew": false,
              "Required": false,
              "PostData": true,
              "MaxLength": 20,
              "LabelWidth": 132,
              "Width": 360,
              "IsVisible": true,
              "layout": { "colSpan": 6 }
            },
            {
              "fieldId": "SecurityGroupRemarks",
              "Name": "SecurityGroupRemarks",
              "label": "Remarks",
              "type": "textarea",
              "FieldType": "textarea",
              "Required": false,
              "PostData": true,
              "MaxLength": 2000,
              "DefaultValue": "",
              "LabelWidth": 90,
              "Width": 336,
              "Placeholder": "Enter Remarks",
              "IsVisible": true,
              "layout": { "colSpan": 8 }
            },
            {
              "fieldId": "EmployeeDateOfJoining",
              "Name": "EmployeeDateOfJoining",
              "label": "Effective Date",
              "type": "date",
              "FieldType": "date",
              "Required": false,
              "PostData": true,
              "DefaultValue": "today",
              "LabelWidth": 155,
              "Width": 210,
              "IsVisible": true,
              "layout": { "colSpan": 4 }
            }
          ]
        }

      ]
    },

    {
      "pageId": "Denominations",
      "pageName": "Denomination Setup",
      "sections": [
        {
          "sectionId": "DenomGrid",
          "sectionName": "Denomination Lines",
          "layout": { "columns": 12 },
          "fields": [],
          "grid": {
            "fieldId": "DenominationLines",
            "entity": "InstrumentDenomination",
            "allowAdd": true,
            "allowDelete": true,
            "columns": [
              {
                "fieldId": "DenominationValue",
                "label": "Denomination Value (₹)",
                "type": "number",
                "DefaultValue": 0
              },
              {
                "fieldId": "DenominationType",
                "label": "Type",
                "type": "select",
                "lookup": {
                  "valueField": "id",
                  "displayField": "name",
                  "options": [
                    { "id": "Note",         "name": "Note" },
                    { "id": "Coin",         "name": "Coin" },
                    { "id": "DigitalToken", "name": "Digital Token" }
                  ]
                }
              },
              {
                "fieldId": "DenominationDescription",
                "label": "Description",
                "type": "input",
                "DefaultValue": ""
              },
              {
                "fieldId": "IsActive",
                "label": "Active",
                "type": "checkbox",
                "DefaultValue": 1
              }
            ]
          }
        }
      ]
    }

  ],

  "quickActions": [
    {
      "actionId": "ChangeStatus",
      "label": "Change Status",
      "api": "Finance.Instrument.ChangeStatus",
      "fields": [
        {
          "fieldId": "InstrumentStatusOfInstrument",
          "fieldName": "InstrumentStatusOfInstrument",
          "label": "New Status",
          "type": "select",
          "lookup": {
            "valueField": "id",
            "displayField": "name",
            "options": [
              { "id": 0, "name": "Pending" },
              { "id": 1, "name": "Realisation" }
            ]
          }
        }
      ]
    },
    {
      "actionId": "UpdateValidity",
      "label": "Update Validity Days",
      "api": "Finance.Instrument.UpdateValidity",
      "fields": [
        {
          "fieldId": "InstrumentValidityPeriodInDays",
          "fieldName": "InstrumentValidityPeriodInDays",
          "label": "Validity Days",
          "type": "number"
        }
      ]
    },
    {
      "actionId": "AddRemark",
      "label": "Add Remark",
      "api": "Finance.Instrument.AddRemark",
      "fields": [
        {
          "fieldId": "SecurityGroupRemarks",
          "fieldName": "SecurityGroupRemarks",
          "label": "Remarks",
          "type": "textarea"
        }
      ]
    }
  ],

  "serverValidations": [
    {
      "id": "NameUniquenessCheck",
      "trigger": ["onChange"],
      "fields": ["InstrumentName"],
      "api": "Finance.Instrument.ValidateName",
      "params": {
        "instrumentName": "InstrumentName",
        "instrumentType": "InstrumentType"
      },
      "errorField": "InstrumentName",
      "severity": "error"
    }
  ],

  "api": {
    "save":   "Finance.Instrument.Save",
    "update": "Finance.Instrument.Update",
    "delete": "Finance.Instrument.Delete"
  }
}