package com.qqchen.deploy.backend.notification.entity;

import com.qqchen.deploy.backend.framework.annotation.LogicDelete;
import com.qqchen.deploy.backend.framework.domain.Entity;
import com.qqchen.deploy.backend.notification.enums.NotificationChannelStatusEnum;
import com.qqchen.deploy.backend.notification.enums.NotificationChannelTypeEnum;
import com.vladmihalcea.hibernate.type.json.JsonType;
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Type;

import java.util.Map;

/**
 * 通知渠道实体
 *
 * @author qqchen
 * @since 2025-10-22
 */
@Data
@EqualsAndHashCode(callSuper = true)
@jakarta.persistence.Entity
@Table(name = "sys_notification_channel")
@LogicDelete
public class NotificationChannel extends Entity<Long> {
    
    /**
     * 渠道名称
     */
    @Column(nullable = false, length = 100)
    private String name;
    
    /**
     * 渠道类型
     */
    @Enumerated(EnumType.STRING)
    @Column(name = "channel_type", nullable = false, length = 50)
    private NotificationChannelTypeEnum channelType;
    
    /**
     * 渠道配置（JSON格式，不同渠道存储不同字段）
     */
    @Type(JsonType.class)
    @Column(nullable = false, columnDefinition = "JSON")
    private Map<String, Object> config;
    
    /**
     * 状态
     */
    @Enumerated(EnumType.STRING)
    @Column(nullable = false, length = 20)
    private NotificationChannelStatusEnum status = NotificationChannelStatusEnum.ENABLED;
    
    /**
     * 描述
     */
    @Column(length = 500)
    private String description;
}

