{
    "table_name": "supplier_deliveries",
    "display_name": "仕入配送先マスタ",
    "description": "仕入先別の配送先情報管理",
    "type": "relational_table",
    "supported_modes": ["insert", "update", "delete"],
    "key_fields": ["id"],
    "required_fields": [
        "supplier_id",
        "is_active"
    ],
    "unique_fields": {},
    "code_padding": {
        "supplier_code": 3
    },
    "foreign_key_mappings": {
        "supplier_code": {
            "target_field": "supplier_id",
            "reference_table": "suppliers",
            "reference_key_column": "supplier_code",
            "reference_value_column": "id",
            "required": true,
            "error_message": "指定された仕入先コード「{value}」が仕入先マスタに存在しません。正しい仕入先コードを確認してください。"
        }
    },
    "composite_key_handling": {
        "update_mode": "primary_key_only",
        "delete_mode": "primary_key_only",
        "primary_key_field": "id"
    },
    "field_labels": {
        "id": "ID",
        "supplier_id": "仕入先ID",
        "supplier_code": "仕入先コード",
        "delivery_name": "配送先名",
        "delivery_contact": "配送先担当者",
        "postal_code": "郵便番号",
        "prefecture": "都道府県",
        "address1": "住所１",
        "address2": "住所２",
        "address3": "住所３",
        "tel": "TEL",
        "fax": "FAX",
        "note": "備考",
        "is_active": "有効フラグ",
        "created_by": "登録者ID",
        "updated_by": "更新者ID",
        "created_at": "登録日",
        "updated_at": "更新日",
        "deleted_at": "削除日"
    },
    "field_types": {
        "id": "bigint",
        "supplier_id": "bigint",
        "supplier_code": "varchar",
        "delivery_name": "varchar",
        "delivery_contact": "varchar",
        "postal_code": "varchar",
        "prefecture": "varchar",
        "address1": "varchar",
        "address2": "varchar",
        "address3": "varchar",
        "tel": "varchar",
        "fax": "varchar",
        "note": "varchar",
        "is_active": "int",
        "created_by": "bigint",
        "updated_by": "bigint",
        "created_at": "timestamp",
        "updated_at": "timestamp",
        "deleted_at": "timestamp"
    },
    "enum_values": {
        "is_active": {
            "1": "有効",
            "9": "無効"
        }
    },
    "validation_rules": {
        "supplier_id": {
            "required": true,
            "exists": {
                "table": "suppliers",
                "column": "id"
            }
        },
        "delivery_name": {
            "max_length": 200
        },
        "delivery_contact": {
            "max_length": 200
        },
        "postal_code": {
            "pattern": "^\\d{3}-?\\d{4}$",
            "message": "郵便番号の形式が正しくありません。「123-4567」または「1234567」の形式で入力してください。入力値：「{value}」"
        },
        "prefecture": {
            "max_length": 20
        },
        "address1": {
            "max_length": 500
        },
        "address2": {
            "max_length": 500
        },
        "address3": {
            "max_length": 500
        },
        "tel": {
            "max_length": 20
        },
        "fax": {
            "max_length": 20
        },
        "note": {
            "max_length": 500
        },
        "is_active": {
            "enum": [1, 9]
        }
    }
}