{
    "name": "friendtalk_msg",
    "description": "친구톡(브랜드메시지) 발송 트리거 엔티티 — Hook 또는 API를 통해 생성되면 친구톡 발송이 시작됩니다.",
    "history": false,
    "fields": {
        "receiver": {
            "index": true,
            "hash": true,
            "comment": "수신자 전화번호",
            "required": true
        },
        "msg_type": {
            "index": true,
            "type": [
                "text",
                "image",
                "wide_image",
                "wide_item_list",
                "carousel"
            ],
            "default": "text"
        },
        "status": {
            "index": true,
            "type": [
                "pending",
                "processing",
                "sent",
                "failed"
            ],
            "default": "pending"
        },
        "content": {
            "type": "text",
            "required": true,
            "comment": "메시지 본문"
        },
        "image_url": {
            "comment": "이미지 URL"
        },
        "image_link": {
            "comment": "이미지 클릭 시 이동 URL"
        },
        "is_ad": {
            "type": "bool",
            "default": true,
            "comment": "광고성 메시지 여부"
        },
        "buttons_json": {
            "type": "text",
            "comment": "버튼 목록 JSON"
        },
        "carousel_json": {
            "type": "text",
            "comment": "캐러셀 데이터 JSON"
        },
        "items_json": {
            "type": "text",
            "comment": "와이드 아이템 리스트 JSON"
        },
        "header": {
            "comment": "와이드 아이템 리스트 헤더"
        },
        "provider": {
            "comment": "프로바이더 키 (빈 값이면 default)"
        },
        "ref_entity": {
            "comment": "참조 엔티티 이름"
        },
        "ref_seq": {
            "type": "int"
        }
    },
    "hooks": {
        "after_insert": [
            {
                "type": "friendtalk",
                "friendtalk_receiver": "${new.receiver}",
                "friendtalk_content": "${new.content}",
                "friendtalk_msg_type": "${new.msg_type}",
                "friendtalk_image_url": "${new.image_url}",
                "friendtalk_image_link": "${new.image_link}",
                "friendtalk_is_ad": "${new.is_ad}",
                "friendtalk_buttons_json": "${new.buttons_json}",
                "friendtalk_carousel_json": "${new.carousel_json}",
                "friendtalk_items_json": "${new.items_json}",
                "friendtalk_header": "${new.header}"
            }
        ]
    }
}
