using MessagePack;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace XPrintServer.DataModel.Models
{
    ///<summary>
    ///模型部件表
    ///</summary>
    [SugarIndex("idx_{split_table}_create_time", nameof(CreateTime), OrderByType.Desc)]
    [SplitTable(SplitType.Year)]//按年分表 （自带分表支持 年、季、月、周、日）
    [SugarTable("model_part_{year}{month}{day}")]//3个变量必须要有，这么设计为了兼容开始按年，后面改成按月、按日
    public partial class ModelPart
    {
        public ModelPart()
        {
        }

        /// <summary>
        /// Desc:Id
        /// Default:
        /// Nullable:False
        /// </summary>           
        [Key("Id")]
        [SugarColumn(IsPrimaryKey = true, ColumnDescription = "主键Id")]
        public Guid Id { get; set; }

        /// <summary>
        /// Desc:模型Id
        /// Default:
        /// Nullable:False
        /// </summary>    
        [Key("ModelId")]
        [SugarColumn(IsNullable = false, ColumnDescription = "模型Id")]
        public Guid ModelId { get; set; }

        /// <summary>
        /// Desc:部件关键字（对应模型部件材质名称，唯一）
        /// Default:
        /// Nullable:False
        /// </summary>    
        [Key("PartKey")]
        [SugarColumn(IsNullable = false, ColumnDescription = "部件关键字（对应模型部件材质名称，唯一）")]
        public string PartKey { get; set; } = null!;

        /// <summary>
        /// Desc:片材名（显示用）
        /// Default:
        /// Nullable:False
        /// </summary>    
        [Key("PartName")]
        [SugarColumn(IsNullable = false, ColumnDescription = "片材名（显示用）")]
        public string PartName { get; set; } = null!;


        /// <summary>
        /// Desc:编辑蒙板图
        /// Default:
        /// Nullable:False
        /// </summary>    
        [Key("MaskImageUrl")]
        [SugarColumn(IsNullable = false, ColumnDescription = "编辑蒙板图")]
        public string MaskImageUrl { get; set; } = null!;

        /// <summary>
        /// Desc:UV的X坐标
        /// Nullable:False
        /// </summary>    
        [Key("UVX")]
        [SugarColumn(IsNullable = false, ColumnDescription = "部件UV的X坐标")]
        public int UVX { get; set; } = 0;

        /// <summary>
        /// Desc:UV的Y坐标
        /// Nullable:False
        /// </summary>    
        [Key("UVY")]
        [SugarColumn(IsNullable = false, ColumnDescription = "部件UV的Y坐标")]
        public int UVY { get; set; } = 0;

        /// <summary>
        /// Desc:部件UV的宽度
        /// Nullable:False
        /// </summary>    
        [Key("UVWidth")]
        [SugarColumn(IsNullable = false, ColumnDescription = "部件UV的宽度")]
        public int UVWidth { get; set; } = 0;

        /// <summary>
        /// Desc:部件UV的高度
        /// Nullable:False
        /// </summary>    
        [Key("UVHeight")]
        [SugarColumn(IsNullable = false, ColumnDescription = "部件UV的高度")]
        public int UVHeight { get; set; } = 0;


        /// <summary>
        /// Desc:生产图的X坐标
        /// Nullable:False
        /// </summary>    
        [Key("ProductImageX")]
        [SugarColumn(IsNullable = false, ColumnDescription = "生产图的X坐标")]
        public int ProductImageX { get; set; } = 0;

        /// <summary>
        /// Desc:生产图的Y坐标
        /// Nullable:False
        /// </summary>    
        [Key("ProductImageY")]
        [SugarColumn(IsNullable = false, ColumnDescription = "生产图的Y坐标")]
        public int ProductImageY { get; set; } = 0;

        /// <summary>
        /// Desc:生产图的宽度
        /// Nullable:False
        /// </summary>    
        [Key("ProductImageWidth")]
        [SugarColumn(IsNullable = false, ColumnDescription = "生产图的宽度")]
        public int ProductImageWidth { get; set; } = 0;

        /// <summary>
        /// Desc:生产图的高度
        /// Nullable:False
        /// </summary>    
        [Key("ProductImageHeight")]
        [SugarColumn(IsNullable = false, ColumnDescription = "生产图的高度")]
        public int ProductImageHeight { get; set; } = 0;

        /// <summary>
        /// Desc:部件的颜色
        /// Nullable:False
        /// </summary>    
        [Key("PartColor")]
        [SugarColumn(IsNullable = false, DefaultValue = "#FFFFFF", ColumnDescription = "部件的颜色")]
        public string PartColor { get; set; } = "#FFFFFF";


        /// <summary>
        /// Desc:是否可以编辑图片
        /// Nullable:False
        /// </summary>    
        [Key("IsCanEditPicture")]
        [SugarColumn(IsNullable = false, ColumnDescription = "是否可以编辑图片")]
        public bool IsCanEditPicture { get; set; } = false;

        /// <summary>
        /// Desc:是否可以编辑颜色
        /// Nullable:False
        /// </summary>    
        [Key("IsCanEditColor")]
        [SugarColumn(IsNullable = false, ColumnDescription = "是否可以编辑颜色")]
        public bool IsCanEditColor { get; set; } = false;


        /// <summary>
        /// Desc:蒙板图缩放值
        /// Nullable:False
        /// </summary>    
        [Key("MaskScale")]
        [SugarColumn(IsNullable = false, DefaultValue = "1", ColumnDescription = "蒙板图缩放值")]
        public float MaskScale { get; set; } = 1f;


        /// <summary>
        /// Desc:选择当前材质后，摄像头的Alpha值
        /// Nullable:False
        /// </summary>    
        [Key("Alpha")]
        [SugarColumn(IsNullable = false, DefaultValue = "0", ColumnDescription = "选择当前材质后，摄像头的Alpha值")]
        public float Alpha { get; set; } = 0f;

        /// <summary>
        /// Desc:选择当前材质后，摄像头的Beta值
        /// Nullable:False
        /// </summary>    
        [Key("Beta")]
        [SugarColumn(IsNullable = false, DefaultValue = "0", ColumnDescription = "选择当前材质后，摄像头的Beta值")]
        public float Beta { get; set; } = 0f;

        /// <summary>
        /// Desc:选择当前材质后，摄像头的Radius值
        /// Nullable:False
        /// </summary>    
        [Key("Radius")]
        [SugarColumn(IsNullable = false, DefaultValue = "0", ColumnDescription = "选择当前材质后，摄像头的Radius值")]
        public float Radius { get; set; } = 0f;

        /// <summary>
        /// Desc:片裁排序值，越小的在越前面
        /// Nullable:False
        /// </summary>    
        [Key("Sort")]
        [SugarColumn(IsNullable = false, DefaultValue = "0", ColumnDescription = "片裁排序值，越小的在越前面")]
        public int Sort { get; set; } = 0;

        [Key("CreateTime")]
        [SplitField] //分表字段 在插入的时候会根据这个字段插入哪个表，在更新删除的时候用这个字段找出相关表
        public DateTime CreateTime { get; set; }

    }
}
