package dto

import "time"

// ListAssetAllocationRecordRequest 分配记录列表请求
type ListAssetAllocationRecordRequest struct {
	Page            int        `json:"page" query:"page" validate:"omitempty,min=1" minimum:"1" description:"页码"`
	PageSize        int        `json:"page_size" query:"page_size" validate:"omitempty,min=1,max=100" minimum:"1" maximum:"100" description:"每页数量"`
	AllocationType  string     `json:"allocation_type" query:"allocation_type" validate:"omitempty,oneof=allocate recall" enum:"allocate,recall" description:"分配类型 (allocate:分配, recall:回收)"`
	AssetType       string     `json:"asset_type" query:"asset_type" validate:"omitempty,oneof=iot_card device" enum:"iot_card,device" description:"资产类型 (iot_card:物联网卡, device:设备)"`
	AssetIdentifier string     `json:"asset_identifier" query:"asset_identifier" validate:"omitempty,max=50" maxLength:"50" description:"资产标识符（ICCID或设备号，模糊查询）"`
	AllocationNo    string     `json:"allocation_no" query:"allocation_no" validate:"omitempty,max=50" maxLength:"50" description:"分配单号（精确匹配）"`
	FromShopID      *uint      `json:"from_shop_id" query:"from_shop_id" description:"来源店铺ID"`
	ToShopID        *uint      `json:"to_shop_id" query:"to_shop_id" description:"目标店铺ID"`
	OperatorID      *uint      `json:"operator_id" query:"operator_id" description:"操作人ID"`
	CreatedAtStart  *time.Time `json:"created_at_start" query:"created_at_start" description:"创建时间起始"`
	CreatedAtEnd    *time.Time `json:"created_at_end" query:"created_at_end" description:"创建时间结束"`
}

// AssetAllocationRecordResponse 分配记录响应
type AssetAllocationRecordResponse struct {
	ID               uint      `json:"id" description:"记录ID"`
	AllocationNo     string    `json:"allocation_no" description:"分配单号"`
	AllocationType   string    `json:"allocation_type" description:"分配类型 (allocate:分配, recall:回收)"`
	AllocationName   string    `json:"allocation_name" description:"分配类型名称"`
	AssetType        string    `json:"asset_type" description:"资产类型 (iot_card:物联网卡, device:设备)"`
	AssetTypeName    string    `json:"asset_type_name" description:"资产类型名称"`
	AssetID          uint      `json:"asset_id" description:"资产ID"`
	AssetIdentifier  string    `json:"asset_identifier" description:"资产标识符（ICCID或设备号）"`
	FromOwnerType    string    `json:"from_owner_type" description:"来源所有者类型"`
	FromOwnerID      *uint     `json:"from_owner_id,omitempty" description:"来源所有者ID"`
	FromOwnerName    string    `json:"from_owner_name" description:"来源所有者名称"`
	ToOwnerType      string    `json:"to_owner_type" description:"目标所有者类型"`
	ToOwnerID        uint      `json:"to_owner_id" description:"目标所有者ID"`
	ToOwnerName      string    `json:"to_owner_name" description:"目标所有者名称"`
	OperatorID       uint      `json:"operator_id" description:"操作人ID"`
	OperatorName     string    `json:"operator_name" description:"操作人名称"`
	Remark           string    `json:"remark,omitempty" description:"备注"`
	RelatedDeviceID  *uint     `json:"related_device_id,omitempty" description:"关联设备ID"`
	RelatedCardCount int       `json:"related_card_count,omitempty" description:"关联卡数量"`
	CreatedAt        time.Time `json:"created_at" description:"创建时间"`
}

// ListAssetAllocationRecordResponse 分配记录列表响应
type ListAssetAllocationRecordResponse struct {
	List     []*AssetAllocationRecordResponse `json:"items" description:"分配记录列表"`
	Total    int64                            `json:"total" description:"总数"`
	Page     int                              `json:"page" description:"当前页码"`
	PageSize int                              `json:"size" description:"每页数量"`
}

// GetAssetAllocationRecordRequest 获取分配记录详情请求
type GetAssetAllocationRecordRequest struct {
	ID uint `json:"-" params:"id" path:"id" validate:"required,min=1" required:"true" minimum:"1" description:"记录ID"`
}

// AssetAllocationRecordDetailResponse 分配记录详情响应
type AssetAllocationRecordDetailResponse struct {
	AssetAllocationRecordResponse
	RelatedCardIDs []uint `json:"related_card_ids,omitempty" description:"关联卡ID列表"`
}
