package dto

import (

	"go-admin/app/admin/models"
	"go-admin/common/dto"
	common "go-admin/common/models"
)

type LinePreScriptGetPageReq struct {
	dto.Pagination     `search:"-"`
    ApiId int64 `form:"apiId"  search:"type:exact;column:api_id;table:line_pre_script" comment:"api用户"`
    Status string `form:"status"  search:"type:exact;column:status;table:line_pre_script" comment:"执行状态:0=等待执行,1=执行中,2=执行结束"`
    LinePreScriptOrder
}

type LinePreScriptOrder struct {
    Id string `form:"idOrder"  search:"type:order;column:id;table:line_pre_script"`
    ApiId string `form:"apiIdOrder"  search:"type:order;column:api_id;table:line_pre_script"`
    ScriptNum string `form:"scriptNumOrder"  search:"type:order;column:script_num;table:line_pre_script"`
    ScriptParams string `form:"scriptParamsOrder"  search:"type:order;column:script_params;table:line_pre_script"`
    Status string `form:"statusOrder"  search:"type:order;column:status;table:line_pre_script"`
    Desc string `form:"descOrder"  search:"type:order;column:desc;table:line_pre_script"`
    AdminId string `form:"adminIdOrder"  search:"type:order;column:admin_id;table:line_pre_script"`
    CreatedAt string `form:"createdAtOrder"  search:"type:order;column:created_at;table:line_pre_script"`
    UpdatedAt string `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:line_pre_script"`
    DeletedAt string `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:line_pre_script"`
    CreateBy string `form:"createByOrder"  search:"type:order;column:create_by;table:line_pre_script"`
    UpdateBy string `form:"updateByOrder"  search:"type:order;column:update_by;table:line_pre_script"`
    
}

func (m *LinePreScriptGetPageReq) GetNeedSearch() interface{} {
	return *m
}

type LinePreScriptInsertReq struct {
    Id int `json:"-" comment:""` // 
    ApiId int64 `json:"apiId" comment:"api用户"`
    ScriptNum int64 `json:"scriptNum" comment:"脚本批次"`
    ScriptParams string `json:"scriptParams" comment:"脚本参数"`
    Status string `json:"status" comment:"执行状态:0=等待执行,1=执行中,2=执行结束"`
    Desc string `json:"desc" comment:"运行备注"`
    AdminId int64 `json:"adminId" comment:"管理员id"`
    common.ControlBy
}

func (s *LinePreScriptInsertReq) Generate(model *models.LinePreScript)  {
    if s.Id == 0 {
        model.Model = common.Model{ Id: s.Id }
    }
    model.ApiId = s.ApiId
    model.ScriptNum = s.ScriptNum
    model.ScriptParams = s.ScriptParams
    model.Status = s.Status
    model.Desc = s.Desc
    model.AdminId = s.AdminId
    model.CreateBy = s.CreateBy // 添加这而，需要记录是被谁创建的
}

func (s *LinePreScriptInsertReq) GetId() interface{} {
	return s.Id
}

type LinePreScriptUpdateReq struct {
    Id int `uri:"id" comment:""` // 
    ApiId int64 `json:"apiId" comment:"api用户"`
    ScriptNum int64 `json:"scriptNum" comment:"脚本批次"`
    ScriptParams string `json:"scriptParams" comment:"脚本参数"`
    Status string `json:"status" comment:"执行状态:0=等待执行,1=执行中,2=执行结束"`
    Desc string `json:"desc" comment:"运行备注"`
    AdminId int64 `json:"adminId" comment:"管理员id"`
    common.ControlBy
}

func (s *LinePreScriptUpdateReq) Generate(model *models.LinePreScript)  {
    if s.Id == 0 {
        model.Model = common.Model{ Id: s.Id }
    }
    model.ApiId = s.ApiId
    model.ScriptNum = s.ScriptNum
    model.ScriptParams = s.ScriptParams
    model.Status = s.Status
    model.Desc = s.Desc
    model.AdminId = s.AdminId
    model.UpdateBy = s.UpdateBy // 添加这而，需要记录是被谁更新的
}

func (s *LinePreScriptUpdateReq) GetId() interface{} {
	return s.Id
}

// LinePreScriptGetReq 功能获取请求参数
type LinePreScriptGetReq struct {
     Id int `uri:"id"`
}
func (s *LinePreScriptGetReq) GetId() interface{} {
	return s.Id
}

// LinePreScriptDeleteReq 功能删除请求参数
type LinePreScriptDeleteReq struct {
	Ids []int `json:"ids"`
}

func (s *LinePreScriptDeleteReq) GetId() interface{} {
	return s.Ids
}
