-- 技师服务项目表
DROP TABLE IF EXISTS `coach_project`;
CREATE TABLE `coach_project` (
    `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
    `coach_id` bigint UNSIGNED NOT NULL COMMENT '技师ID',
    `project_id` bigint UNSIGNED NOT NULL COMMENT '项目ID',
    `discount_amount` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '优惠金额',
    `service_gender` varchar(20) NOT NULL DEFAULT 'all' COMMENT '服务性别(all:不限 male:男 female:女)',
    `service_distance` int NOT NULL DEFAULT 0 COMMENT '服务距离(米)',
    `traffic_fee_type` varchar(20) NOT NULL DEFAULT 'free' COMMENT '收取路费(free:免费 one_way:单程 round_trip:双程)',
    `traffic_fee` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '路费金额',
    `state` varchar(20) NOT NULL DEFAULT 'enable' COMMENT '状态(enable:启用 disable:禁用)',
    `created_at` timestamp NULL DEFAULT NULL COMMENT '创建时间',
    `updated_at` timestamp NULL DEFAULT NULL COMMENT '更新时间',
    `deleted_at` timestamp NULL DEFAULT NULL COMMENT '删除时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `uk_coach_project` (`coach_id`, `project_id`),
    KEY `idx_coach_id` (`coach_id`),
    KEY `idx_project_id` (`project_id`),
    KEY `idx_state` (`state`),
    CONSTRAINT `fk_cp_coach` FOREIGN KEY (`coach_id`) REFERENCES `coach_users` (`id`),
    CONSTRAINT `fk_cp_project` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '技师服务项目表';