package com.liquidnet.service.kylin.dto.param;

import com.liquidnet.service.kylin.entity.KylinArtist;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 艺人管理参数
 *
 * @author system
 * @since 2026-02-04
 */
@Data
@ApiModel("艺人管理参数")
public class ArtistParam {

    @ApiModelProperty(value = "艺人ID")
    private String artistId;

    @ApiModelProperty(value = "艺人名称")
    private String artistName;

    @ApiModelProperty(value = "艺人类型 1音乐人 2艺术家 3厂牌 4品牌方")
    private Integer artistType;

    @ApiModelProperty(value = "艺人头像")
    private String avatarUrl;

    @ApiModelProperty(value = "艺人简介")
    private String introduction;

    @ApiModelProperty(value = "艺人相册图片列表")
    private List<String> albumImages;

    @ApiModelProperty(value = "排序权重")
    private Integer sort;

    @ApiModelProperty(value = "状态 0禁用 1启用")
    private Integer status;

    @ApiModelProperty(value = "批量操作的ID列表")
    private List<String> ids;

    public KylinArtist getFields(String artistId, LocalDateTime createdAt) {
        KylinArtist kylinArtist = new KylinArtist();
        BeanUtils.copyProperties(this, kylinArtist);
        
        if (artistId != null) {
            kylinArtist.setArtistId(artistId);
        }
        if (createdAt != null) {
            kylinArtist.setCreatedAt(createdAt);
        }
        kylinArtist.setUpdatedAt(LocalDateTime.now());
        
        // 设置默认值
        if (kylinArtist.getStatus() == null) {
            kylinArtist.setStatus(1);
        }
        if (kylinArtist.getSort() == null) {
            kylinArtist.setSort(0);
        }
        return kylinArtist;
    }
}
