package com.muchinfo.mtp3pojos.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * <p>
 * 市场表
 * </p>
 *
 * @author XKF
 * @since 2024-07-02
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("MARKET")
@ApiModel(value="Market对象", description="市场表")
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Market extends Model<Market> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "市场ID正常5位，前三位固定：两位表示交易模式， 一位表示交易属性(1:收益权，2：所有权) 其它特殊市场：0-系统 1-交割服务 2-账户服务3-履约服务 4-仓单服务 5-积分服务 6-银行服务")
    @TableId(value = "MARKETID")
    private Long marketid;

    @ApiModelProperty(value = "市场名称")
    @TableField("MARKETNAME")
    private String marketname;

    @ApiModelProperty(value = "所属交易所，可以没有")
    @TableField("EXCHAREAID")
    private Long exchareaid;

    @ApiModelProperty(value = "市场类型- 1:非交易服务 2:交易服务")
    @TableField("MARKETTYPE")
    private Integer markettype;

    @ApiModelProperty(value = "交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式 21:竞拍-大宗式 22:受托竞价")
    @TableField("TRADEMODE")
    private Integer trademode;

    @ApiModelProperty(value = "交易属性 -  1:收益权(可做空) 2:所有权(不可做空) 3:期权 4:现货 5:参考行情 6:通道交易 7:币交易 8:场外期权")
    @TableField("TRADEPROPERTY")
    private Integer tradeproperty;

    @ApiModelProperty(value = "开盘模式 - 0 自动 1手动")
    @TableField("OPENMETHOD")
    private Integer openmethod;

    @ApiModelProperty(value = "结算价算法: 1:最后多少笔成交价加权平均 2:最后多少秒成交价加权平均 3:全天加权平均 4:最后一口价 5.买一价 6.卖一价 7.买一卖一均价 8.外部结算价 ")
    @TableField("RECKONPRICEALGORITHM")
    private Integer reckonpricealgorithm;

    @ApiModelProperty(value = "结算价参数")
    @TableField("RECKONPRICEPARAM")
    private Long reckonpriceparam;

    @ApiModelProperty(value = "生效状态(ValidStatus枚举): 1:待生效 2:正常 3:注销")
    @TableField("MARKETSTATUS")
    private Integer marketstatus;

    @ApiModelProperty(value = "市场服务ID")
    @TableField("MARKETSERVICEID")
    private Integer marketserviceid;

    @ApiModelProperty(value = "持仓保证金公式 - 1:双边收 2:净头寸收 3:大小边差异收 4:大边收 5:卖持仓收(仅期权)")
    @TableField("MARGINFORMULA")
    private Integer marginformula;

    @ApiModelProperty(value = "履约计划模板ID - 作废")
    @TableField("PERFORMANCETEMPID")
    private BigDecimal performancetempid;

    @ApiModelProperty(value = "待开市间隔(交易市场开盘前多久发市场待开市信号(单位分钟))")
    @TableField("CLEARINTERVAL")
    private Integer clearinterval;

    @ApiModelProperty(value = "指定对手模式[仓单贸易模式专用] - 1:任意对手 - 作废")
    @TableField("MATCHERMODE")
    private Integer matchermode;

    @ApiModelProperty(value = "结算顺序")
    @TableField("RECKONORDER")
    private Integer reckonorder;

    @ApiModelProperty(value = " [期权]是否可预申报- 0:否 1:是")
    @TableField("CANPREEXERCISE")
    private Integer canpreexercise;

    @ApiModelProperty(value = " [期权]是否可现货行权- 0:否 1:是  是否交收")
    @TableField("CANGOODSEXERCISE")
    private Integer cangoodsexercise;

    @ApiModelProperty(value = "商品类型 - 1:交易商品 2:仓单商品")
    @TableField("GOODSTYPE")
    private Integer goodstype;

    @ApiModelProperty(value = "角色优先类型 - 1:无 2:报价商优先 3:非报价商优先 [16:挂牌点选]")
    @TableField("ROLEPRIORITYTYPE")
    private Integer roleprioritytype;

    @ApiModelProperty(value = "是否记录成交源 - 0:不记录 1:记录 [所有权]")
    @TableField("ISRECORDSOURCE")
    private Integer isrecordsource;

    @ApiModelProperty(value = "持仓保证金公式(仅受托竞价) - 1:双边收 2:净头寸收 3:大小边差异收 4:大边收 5:卖持仓收(仅期权)")
    @TableField("MARGINFORMULA2")
    private Integer marginformula2;

    @ApiModelProperty(value = "[竞拍]是否需要仓单 -  0:不需要  1:需要- 作废")
    @TableField("HASWR")
    private Integer haswr;

    @ApiModelProperty(value = "权利金报价方式 - 1:自动 2:手动")
    @TableField("PREMIUMQUOTEMODE")
    private Integer premiumquotemode;

    @ApiModelProperty(value = "可现货行权期权类型 - 1:认购 2认沽 3:认购认沽 [CanGoodsExercise = 1时可设置]")
    @TableField("CANGOODSEXERCISETYPE")
    private Integer cangoodsexercisetype;

    @ApiModelProperty(value = "确认行权是否接收行情 - 0:不接受 1:接受 [可确认权的挂牌期权市场可配置]")
    @TableField("CANACCEPTQUOTE")
    private Integer canacceptquote;

    @ApiModelProperty(value = "是否可多段运行 – 0:不可 1:可 [挂牌期权]")
    @TableField("CANMUTISTAGE")
    private Integer canmutistage;

    @ApiModelProperty(value = "竞拍违约是否扣除保证金[竞拍-降价式] - 0:不扣 1:扣除")
    @TableField("ISDEDUCTMARGIN")
    private Integer isdeductmargin;

    @ApiModelProperty(value = "是否可手动报行权价- 0:否 1:是 [期权]")
    @TableField("CANMANUALQUOTESTRIKE")
    private Integer canmanualquotestrike;

    @ApiModelProperty(value = "下单方式[通道交易] - 1:直接转单 2:净头寸下单")
    @TableField("TRADETYPE")
    private Integer tradetype;

    @ApiModelProperty(value = "待开市时间标识[通道交易-对冲] -  0:当日 1:上日 ")
    @TableField("PENDINGFLAG")
    private Integer pendingflag;

    @ApiModelProperty(value = "待开市时间[通道交易-对冲](HH:mm)")
    @TableField("PENDINGTIME")
    private String pendingtime;

    @ApiModelProperty(value = "结算时间[通道交易-对冲](HH:mm)")
    @TableField("RECKONTIME")
    private String reckontime;

    @ApiModelProperty(value = "是否交易授信[做市收益权] - 0:不授信 1:授信")
    @TableField("HASTRADECREDIT")
    private Integer hastradecredit;

    @ApiModelProperty(value = "合同模板[荷兰式][竞价式][仓单贸易]")
    @TableField("CONTRACTTMP")
    private String contracttmp;

    @ApiModelProperty(value = "是否返利[竞价式]  0:不返，1:返利 -- 根据系统参数088显示或隐藏")
    @TableField("HASREBATE")
    private Integer hasrebate;

    @ApiModelProperty(value = "返利比率[竞价式]")
    @TableField("REBATERATIO")
    private BigDecimal rebateratio;

    @ApiModelProperty(value = "场外期权做市商[场外期权]")
    @TableField("OTCUSERID")
    private BigDecimal otcuserid;

    @ApiModelProperty(value = "外部同步时间点(h24:mi:ss)[场外期权]")
    @TableField("OUTERSYNCTIME")
    private String outersynctime;

    @ApiModelProperty(value = "仓单类型(现货交易) - 1:无仓单 2:有仓单 3;有无仓单均可")
    @TableField("AUCTIONWRTYPE")
    private Integer auctionwrtype;

    @ApiModelProperty(value = "成交参与保证金是否释放[竞价式] - 0:不释放 1释放")
    @TableField("ISRELEASEMARGIN")
    private Integer isreleasemargin;

    @ApiModelProperty(value = "卖挂牌是否需要审核(仓单贸易) - 0:不需要 1:需要")
    @TableField("SELLLISTINGAUDITFLAG")
    private Integer selllistingauditflag;

    @ApiModelProperty(value = "交易市场类型 - 1:合约市场 2:外部市场 3:仓单市场")
    @TableField("TRADEMARKETTYPE")
    private Integer trademarkettype;

    @ApiModelProperty(value = "是否支持后付 - 0:不支持 1;支持 - [挂牌点选 所有权、预售挂牌支持]")
    @TableField("PAYLATERFLAG")
    private Integer paylaterflag;

    @ApiModelProperty(value = "输入结算价标识 - 0:系统生成 1:手工输入(自动) 2:手工输入(手动)")
    @TableField("ISUPDATERECKONPRICE")
    private Integer isupdatereckonprice;

    @ApiModelProperty(value = "输入结算价时长(分钟) [1:手工输入(自动)]")
    @TableField("UPDATERECKONPRICEINTERVAL")
    private Integer updatereckonpriceinterval;

    @ApiModelProperty(value = "融资回购市场ID [仓单贸易]")
    @TableField("FINANCEMARKETID")
    private Long financemarketid;

    @ApiModelProperty(value = "定期强平方式 - 1:到期结 2:日结 3:周结 4:月结  [收益权] 枚举-forceCloseMode")
    @TableField("FORCECLOSEMODE")
    private Integer forceclosemode;

    @ApiModelProperty(value = "定期强平参数 [收益权]（周结、月结）")
    @TableField("FORCECLOSEVALUE")
    private BigDecimal forceclosevalue;

    @ApiModelProperty(value = "交收方式(50模式) 1:配对交收 2:强平日交收")
    @TableField("DELIVERYMODE")
    private Integer deliverymode;

    @ApiModelProperty(value = "卖方是否可申请交收(50模式 - DeliveryMode = 2时) - 0:否 1：是")
    @TableField("ISDELIVERYSELLERCANAPPLY")
    private Integer isdeliverysellercanapply;

    @ApiModelProperty(value = "交收买方是否线上支付(50模式) - 0:否 1：是")
    @TableField("ISDELIVERYBUYERPAYONLINE")
    private Integer isdeliverybuyerpayonline;

    @ApiModelProperty(value = "风控方式(52模式) 1：按单风控 2：按账户风控")
    @TableField("RISKCONTROLMODE")
    private Integer riskcontrolmode;

    @TableField(select = false)
    private Integer roletype;

    @TableField(select = false)
    private Integer spotrighttype;

    @TableField(select = false)
    private Integer buyspotrighttype;
    @Override
    public Serializable pkVal() {
        return this.marketid;
    }

}
