package jsm

type Links struct {
	Self     string `json:"self"`
	Base     string `json:"base"`
	Context  string `json:"context"`
	JiraRest string `json:"jiraRest"`
	Web      string `json:"web"`
}

type AvatarUrls struct {
	Size48x48 string `json:"48x48"`
	Size24x24 string `json:"24x24"`
	Size16x16 string `json:"16x16"`
	Size32x32 string `json:"32x32"`
}

type AccountInfo struct {
	AccountId    string `json:"accountId"`
	EmailAddress string `json:"emailAddress"`
	DisplayName  string `json:"displayName"`
	Active       bool   `json:"active"`
	TimeZone     string `json:"timeZone"`
	Links        struct {
		JiraRest   string     `json:"jiraRest"`
		AvatarUrls AvatarUrls `json:"avatarUrls"`
		Self       string     `json:"self"`
	} `json:"_links"`
}

type GetAccountIDResponse struct {
	Size       int           `json:"size"`
	Start      int           `json:"start"`
	Limit      int           `json:"limit"`
	IsLastPage bool          `json:"isLastPage"`
	Links      Links         `json:"_links"`
	Values     []AccountInfo `json:"values"`
}

type GetAssertFieldRequest struct {
	FieldValueMap map[string]string `json:"fieldValueMap"`
}

type CreateJsmParam struct {
	JsmAccountID   string
	OrgID          string
	ClusterID      string
	Summary        string
	Description    string
	Severity       string
	DeploymentType string
	ClusterVersion string
	ClusterType    string
	AttachmentIDs  []string
}

type CreateJsmParamConvertIDs struct {
	ComponentID      string
	VersionID        string
	SeverityID       string
	ImpactID         string
	EnvironmentID    string
	DeploymentTypeID string
	ClusterVersionID string
}

type RequestFieldItem struct {
	ID    string `json:"id,,omitempty"`
	Value string `json:"value,omitempty"`
}
type RequestFieldValues struct {
	Summary     string `json:"summary"`
	Description string `json:"description"`
	Versions    []struct {
		ID string `json:"id"`
	} `json:"versions"`
	Components []struct {
		ID string `json:"id"`
	} `json:"components"`
	Customfield10050 struct {
		Value string `json:"value"`
	} `json:"customfield_10050"`
	Customfield10102 []struct {
		ID string `json:"id"`
	} `json:"customfield_10102"`
	Customfield10090 []struct {
		ID string `json:"id"`
		// ID string `json:"id"`
	} `json:"customfield_10090"`
	Customfield10202 []struct {
		ID string `json:"id"`
	} `json:"customfield_10202"`
}

type Avatar struct {
	URL16             string `json:"url16"`
	URL48             string `json:"url48"`
	URL72             string `json:"url72"`
	URL144            string `json:"url144"`
	URL288            string `json:"url288"`
	MediaClientConfig struct {
		ClientID      string `json:"clientId"`
		Issuer        string `json:"issuer"`
		FileID        string `json:"fileId"`
		MediaBaseUrl  string `json:"mediaBaseUrl"`
		MediaJwtToken string `json:"mediaJwtToken"`
	} `json:"mediaClientConfig"`
}

type ObjectTypeAttribute struct {
	WorkspaceID           string               `json:"workspaceId"`
	ID                    string               `json:"id"`
	ObjectTypeAttributeID string               `json:"objectTypeAttributeId"`
	ObjectTypeAttribute   *ObjectTypeAttribute `json:"objectTypeAttribute"`
	DefaultType           struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"defaultType"`
	ObjectAttributeValues []struct {
		Value        string `json:"value"`
		DisplayValue string `json:"displayValue"`
		SearchValue  string `json:"searchValue"`
	} `json:"objectAttributeValues"`
}

type ObjectType struct {
	WorkspaceID  string `json:"workspaceId"`
	ObjectTypeID string `json:"objectTypeId"`
	ID           string `json:"id"`
	Name         string `json:"name"`
	Description  string `json:"description"`
	Icon         struct {
		ID    string `json:"id"`
		Name  string `json:"name"`
		URL16 string `json:"url16"`
		URL48 string `json:"url48"`
	} `json:"icon"`
	ObjectSchemaID string                `json:"objectSchemaId"`
	Attributes     []ObjectTypeAttribute `json:"attributes"`
}

type Result struct {
	WorkspaceID string     `json:"workspaceId"`
	ID          string     `json:"id"`
	ObjectID    string     `json:"objectId"`
	Label       string     `json:"label"`
	ObjectKey   string     `json:"objectKey"`
	Avatar      Avatar     `json:"avatar"`
	ObjectType  ObjectType `json:"objectType"`
}

type Link struct {
	Self string `json:"self"`
}

type GetAssertFieldResponse struct {
	Size        int      `json:"size"`
	HasNextPage bool     `json:"hasNextPage"`
	Results     []Result `json:"results"`
	Links       Link     `json:"links"`
}

type createPingcapAccountRequest struct {
	DisplayName  string   `json:"displayName"`
	EmailAddress string   `json:"emailAddress"`
	Name         string   `json:"name"`
	Products     []string `json:"products"`
}

type createNormalAccountRequest struct {
	DisplayName string `json:"displayName"`
	Email       string `json:"email"`
}

type createAccountResponse struct {
	AccountID    string `json:"accountId"`
	EmailAddress string `json:"emailAddress"`
}

type addAccountToJsmGroupRequest struct {
	AccountID string `json:"accountId"`
}

type TemporaryAttachment struct {
	TemporaryAttachmentID string `json:"temporaryAttachmentId"`
	FileName              string `json:"fileName"`
}

type UploadAttachmentResp struct {
	TemporaryAttachments []TemporaryAttachment `json:"temporaryAttachments"`
}

type ValidValue struct {
	Value    string `json:"value"`
	Label    string `json:"label"`
	Children []struct {
	} `json:"children,omitempty"`
}

type Field struct {
	FieldID       string        `json:"fieldId"`
	Name          string        `json:"name"`
	Description   string        `json:"description"`
	Required      bool          `json:"required"`
	DefaultValues []interface{} `json:"defaultValues"`
	ValidValues   []ValidValue  `json:"validValues"`
	JiraSchema    JiraSchema    `json:"jiraSchema"`
	Visible       bool          `json:"visible"`
}

type JiraSchema struct {
	Type     string `json:"type"`
	System   string `json:"system"`
	Items    string `json:"items,omitempty"`
	Custom   string `json:"custom,omitempty"`
	CustomID int    `json:"customId,omitempty"`
}

type RequestTypeResponse struct {
	RequestTypeFields         []Field `json:"requestTypeFields"`
	CanRaiseOnBehalfOf        bool    `json:"canRaiseOnBehalfOf"`
	CanAddRequestParticipants bool    `json:"canAddRequestParticipants"`
}

type CreatedDate struct {
	Iso8601     string `json:"iso8601"`
	Jira        string `json:"jira"`
	Friendly    string `json:"friendly"`
	EpochMillis int64  `json:"epochMillis"`
}

type Reporter struct {
	AccountId    string `json:"accountId"`
	EmailAddress string `json:"emailAddress"`
	DisplayName  string `json:"displayName"`
}

type CustomField struct {
	FieldId string      `json:"fieldId"`
	Label   string      `json:"label"`
	Value   interface{} `json:"value"`
}

type CurrentStatus struct {
	Status         string `json:"status"`
	StatusCategory string `json:"statusCategory"`
}

// type Links struct {
//	JiraRest string `json:"jiraRest"`
//	Web      string `json:"web"`
// }

type CreateTicketResponse struct {
	Expands            []string      `json:"_expands"`
	IssueId            string        `json:"issueId"`
	IssueKey           string        `json:"issueKey"`
	RequestTypeId      string        `json:"requestTypeId"`
	ServiceDeskId      string        `json:"serviceDeskId"`
	CreatedDate        CreatedDate   `json:"createdDate"`
	Reporter           Reporter      `json:"reporter"`
	RequestFieldValues []CustomField `json:"requestFieldValues"`
	CurrentStatus      CurrentStatus `json:"currentStatus"`
	Links              Links         `json:"_links"`
}

type AdditionalComment struct {
	Body string `json:"body"`
}

type AddAttachmentRequest struct {
	AdditionalComment      AdditionalComment `json:"additionalComment,omitempty"`
	Public                 bool              `json:"public"`
	TemporaryAttachmentIds []string          `json:"temporaryAttachmentIds"`
}
