package dto

type CreateEnterpriseReq struct {
	EnterpriseName  string `json:"enterprise_name" validate:"required,max=100" required:"true" maximum:"100" description:"企业名称"`
	EnterpriseCode  string `json:"enterprise_code" validate:"required,max=50" required:"true" maximum:"50" description:"企业编号（唯一）"`
	OwnerShopID     *uint  `json:"owner_shop_id" description:"归属店铺ID（可不填则归属平台）"`
	LegalPerson     string `json:"legal_person" validate:"max=50" maximum:"50" description:"法人代表"`
	ContactName     string `json:"contact_name" validate:"required,max=50" required:"true" maximum:"50" description:"联系人姓名"`
	ContactPhone    string `json:"contact_phone" validate:"required,max=20" required:"true" maximum:"20" description:"联系人电话"`
	LoginPhone      string `json:"login_phone" validate:"required,len=11" required:"true" description:"登录手机号（作为企业账号）"`
	Password        string `json:"password" validate:"required,min=6,max=20" required:"true" minimum:"6" maximum:"20" description:"登录密码"`
	BusinessLicense string `json:"business_license" validate:"max=100" maximum:"100" description:"营业执照号"`
	Province        string `json:"province" validate:"max=50" maximum:"50" description:"省份"`
	City            string `json:"city" validate:"max=50" maximum:"50" description:"城市"`
	District        string `json:"district" validate:"max=50" maximum:"50" description:"区县"`
	Address         string `json:"address" validate:"max=255" maximum:"255" description:"详细地址"`
}

type UpdateEnterpriseBody struct {
	OwnerShopID     *uint   `json:"owner_shop_id" description:"归属店铺ID"`
	EnterpriseName  *string `json:"enterprise_name" validate:"omitempty,max=100" maximum:"100" description:"企业名称"`
	EnterpriseCode  *string `json:"enterprise_code" validate:"omitempty,max=50" maximum:"50" description:"企业编号"`
	LegalPerson     *string `json:"legal_person" validate:"omitempty,max=50" maximum:"50" description:"法人代表"`
	ContactName     *string `json:"contact_name" validate:"omitempty,max=50" maximum:"50" description:"联系人姓名"`
	ContactPhone    *string `json:"contact_phone" validate:"omitempty,max=20" maximum:"20" description:"联系人电话"`
	BusinessLicense *string `json:"business_license" validate:"omitempty,max=100" maximum:"100" description:"营业执照号"`
	Province        *string `json:"province" validate:"omitempty,max=50" maximum:"50" description:"省份"`
	City            *string `json:"city" validate:"omitempty,max=50" maximum:"50" description:"城市"`
	District        *string `json:"district" validate:"omitempty,max=50" maximum:"50" description:"区县"`
	Address         *string `json:"address" validate:"omitempty,max=255" maximum:"255" description:"详细地址"`
}

type UpdateEnterpriseReq struct {
	IDReq
	UpdateEnterpriseBody
}

type EnterpriseListReq struct {
	Page           int    `json:"page" query:"page" validate:"omitempty,min=1" minimum:"1" description:"页码（默认1）"`
	PageSize       int    `json:"page_size" query:"page_size" validate:"omitempty,min=1,max=100" minimum:"1" maximum:"100" description:"每页数量（默认20，最大100）"`
	EnterpriseName string `json:"enterprise_name" query:"enterprise_name" description:"企业名称（模糊查询）"`
	LoginPhone     string `json:"login_phone" query:"login_phone" description:"登录手机号（模糊查询）"`
	ContactPhone   string `json:"contact_phone" query:"contact_phone" description:"联系人电话（模糊查询）"`
	OwnerShopID    *uint  `json:"owner_shop_id" query:"owner_shop_id" description:"归属店铺ID"`
	Status         *int   `json:"status" query:"status" description:"状态（0=禁用, 1=启用）"`
}

type EnterpriseItem struct {
	ID              uint   `json:"id" description:"企业ID"`
	EnterpriseName  string `json:"enterprise_name" description:"企业名称"`
	EnterpriseCode  string `json:"enterprise_code" description:"企业编号"`
	OwnerShopID     *uint  `json:"owner_shop_id,omitempty" description:"归属店铺ID"`
	OwnerShopName   string `json:"owner_shop_name" description:"归属店铺名称"`
	LegalPerson     string `json:"legal_person" description:"法人代表"`
	ContactName     string `json:"contact_name" description:"联系人姓名"`
	ContactPhone    string `json:"contact_phone" description:"联系人电话"`
	LoginPhone      string `json:"login_phone" description:"登录手机号"`
	BusinessLicense string `json:"business_license" description:"营业执照号"`
	Province        string `json:"province" description:"省份"`
	City            string `json:"city" description:"城市"`
	District        string `json:"district" description:"区县"`
	Address         string `json:"address" description:"详细地址"`
	Status          int    `json:"status" description:"状态（0=禁用, 1=启用）"`
	StatusName      string `json:"status_name" description:"状态名称"`
	CreatedAt       string `json:"created_at" description:"创建时间"`
}

type EnterprisePageResult struct {
	Items []EnterpriseItem `json:"items" description:"企业列表"`
	Total int64            `json:"total" description:"总记录数"`
	Page  int              `json:"page" description:"当前页码"`
	Size  int              `json:"size" description:"每页数量"`
}

type UpdateEnterpriseStatusBody struct {
	Status int `json:"status" validate:"required,oneof=0 1" required:"true" enum:"0,1" description:"状态（0=禁用, 1=启用）"`
}

type UpdateEnterpriseStatusReq struct {
	IDReq
	UpdateEnterpriseStatusBody
}

type UpdateEnterprisePasswordBody struct {
	Password string `json:"password" validate:"required,min=6,max=20" required:"true" minimum:"6" maximum:"20" description:"新密码"`
}

type UpdateEnterprisePasswordReq struct {
	IDReq
	UpdateEnterprisePasswordBody
}

type CreateEnterpriseResp struct {
	Enterprise EnterpriseItem `json:"enterprise" description:"企业信息"`
	AccountID  uint           `json:"account_id" description:"账号ID"`
}

// CreateEnterpriseRequest 创建企业请求（兼容旧接口）
type CreateEnterpriseRequest = CreateEnterpriseReq

// UpdateEnterpriseRequest 更新企业请求（兼容旧接口）
type UpdateEnterpriseRequest = UpdateEnterpriseBody

// EnterpriseResponse 企业响应（兼容旧接口）
type EnterpriseResponse = EnterpriseItem
