package com.liquidnet.service.kylin.dto.vo.middle;

import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.kylin.dto.vo.partner.KylinTicketTimesPartnerVo;
import com.liquidnet.service.kylin.entity.KylinTicketTimes;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.format.DateTimeFormatter;
import java.util.List;

@Data
@ApiModel
public class KylinTicketTimesVo implements Serializable,Cloneable{

    private Integer mid;
    @ApiModelProperty(value = "主键")
    private String ticketTimesId;
    @ApiModelProperty(value = "名称")
    private String title;
    @ApiModelProperty(value = "类型 1单日 2通票")
    private Integer type;
    @ApiModelProperty(value = "演出id")
    private String performanceId;
    @ApiModelProperty(value = "场次id")
    private String timeId;
    @ApiModelProperty(value = "适用开始时间")
    private String useStart;
    @ApiModelProperty(value = "适用结束时间")
    private String useEnd;
    @ApiModelProperty(value = "是否开启实名认证限购 0关闭 1开启")
    private Integer realNameLimit;
    @ApiModelProperty(value = "票种")
    private List<KylinTicketVo> ticketList;

    private static final KylinTicketTimesVo obj = new KylinTicketTimesVo();
    public static KylinTicketTimesVo getNew() {
        try {
            return (KylinTicketTimesVo) obj.clone();
        } catch (CloneNotSupportedException e) {
            return new KylinTicketTimesVo();
        }
    }

    public void setTicketTimes(KylinTicketTimes ticketTimes) {
        this.mid = ticketTimes.getMid();
        this.ticketTimesId = ticketTimes.getTicketTimesId();
        this.title = ticketTimes.getTitle();
        this.type = ticketTimes.getType();
        this.realNameLimit = ticketTimes.getRealNameLimit();
        this.useStart = DateUtil.Formatter.yyyyMMddHHmmss.format(ticketTimes.getUseStart());
        this.useEnd = DateUtil.Formatter.yyyyMMddHHmmss.format(ticketTimes.getUseEnd());
    }

    public void initTicketTimesPartner(KylinTicketTimesPartnerVo ticketTimes) {
        this.ticketTimesId = ticketTimes.getTicketTimesId();
        this.title = ticketTimes.getTitle();
        this.type = ticketTimes.getType();
        this.useStart = ticketTimes.getUseStart();
        this.useEnd = ticketTimes.getUseEnd();
        this.realNameLimit = ticketTimes.getRealNameLimit();
    }
}
