// Copyright (c) 2017-2025 Tencent. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package v20221229

import (
    tcerr "github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/errors"
    tchttp "github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/http"
    "github.com/tencentcloud/tencentcloud-sdk-go-intl-en/tencentcloud/common/json"
)

// Predefined struct for user
type ChangeClothesRequestParams struct {
	// URL of the model image.
	// Image restrictions: The single-edge resolution must be less than 3,000 and greater than 512, and the size after Base64 encoding must be less than 8 MB.
	// Input requirements:
	// 1. It is recommended to input a frontal model image that at least fully shows the model's body (whole body, upper body or lower body) and avoids large-angle body deflections or complex poses.
	// 2. It is recommended to input a 3:4 ratio image for better generation effect.
	// 3. It is recommended to keep the category of the original clothes in the model image and the category of the replaced clothes the same, or to keep the original clothes' coverage on the model's body equal to or less than the replaced clothes'. (For example, if you need to change the model to wear shorts, the model in the original input image should also wear shorts instead of long pants.) Otherwise, the generation effect will be impaired.
	ModelUrl *string `json:"ModelUrl,omitnil,omitempty" name:"ModelUrl"`

	// URL of the clothes image.
	// Image restrictions: single-side resolution less than 3000 and greater than 512, less than 8MB after conversion to Base64 string.
	// Input requirements:
	// It is recommended to input a complete front-facing flat image of the clothes, containing only one garment in the image. The type of the clothes supports Upper-body, Lower-body and Dress, and you can choose one from the three. The algorithm will change the model's clothes based on the input model image and the input clothes image.
	ClothesUrl *string `json:"ClothesUrl,omitnil,omitempty" name:"ClothesUrl"`

	// Type of the clothes, which needs to be consistent with the input clothes image.
	// Supported value:
	// Upper-body
	// Lower-body
	// Dress
	ClothesType *string `json:"ClothesType,omitnil,omitempty" name:"ClothesType"`

	// Switch indicating whether to add a logo to the generated image. Default value: 1.
	// 1: add logo
	// 0: do not add logo
	// Other values: add logo
	// It is recommended to use an obvious logo to indicate that the image result is generated by AI.
	LogoAdd *int64 `json:"LogoAdd,omitnil,omitempty" name:"LogoAdd"`

	// Logo content settings.
	// By default, the text "Generated by AI" is added to the bottom right corner of the generated image. You can also use other logo.
	LogoParam *LogoParam `json:"LogoParam,omitnil,omitempty" name:"LogoParam"`

	// Image return method (base64 or url).
	// You can specify only one method. Default value: base64.
	// The URL is valid for 1 hour.
	// It is recommended to choose url when the generated image resolution is large. Using base64 may cause return failure due to the image being too large.
	RspImgType *string `json:"RspImgType,omitnil,omitempty" name:"RspImgType"`
}

type ChangeClothesRequest struct {
	*tchttp.BaseRequest
	
	// URL of the model image.
	// Image restrictions: The single-edge resolution must be less than 3,000 and greater than 512, and the size after Base64 encoding must be less than 8 MB.
	// Input requirements:
	// 1. It is recommended to input a frontal model image that at least fully shows the model's body (whole body, upper body or lower body) and avoids large-angle body deflections or complex poses.
	// 2. It is recommended to input a 3:4 ratio image for better generation effect.
	// 3. It is recommended to keep the category of the original clothes in the model image and the category of the replaced clothes the same, or to keep the original clothes' coverage on the model's body equal to or less than the replaced clothes'. (For example, if you need to change the model to wear shorts, the model in the original input image should also wear shorts instead of long pants.) Otherwise, the generation effect will be impaired.
	ModelUrl *string `json:"ModelUrl,omitnil,omitempty" name:"ModelUrl"`

	// URL of the clothes image.
	// Image restrictions: single-side resolution less than 3000 and greater than 512, less than 8MB after conversion to Base64 string.
	// Input requirements:
	// It is recommended to input a complete front-facing flat image of the clothes, containing only one garment in the image. The type of the clothes supports Upper-body, Lower-body and Dress, and you can choose one from the three. The algorithm will change the model's clothes based on the input model image and the input clothes image.
	ClothesUrl *string `json:"ClothesUrl,omitnil,omitempty" name:"ClothesUrl"`

	// Type of the clothes, which needs to be consistent with the input clothes image.
	// Supported value:
	// Upper-body
	// Lower-body
	// Dress
	ClothesType *string `json:"ClothesType,omitnil,omitempty" name:"ClothesType"`

	// Switch indicating whether to add a logo to the generated image. Default value: 1.
	// 1: add logo
	// 0: do not add logo
	// Other values: add logo
	// It is recommended to use an obvious logo to indicate that the image result is generated by AI.
	LogoAdd *int64 `json:"LogoAdd,omitnil,omitempty" name:"LogoAdd"`

	// Logo content settings.
	// By default, the text "Generated by AI" is added to the bottom right corner of the generated image. You can also use other logo.
	LogoParam *LogoParam `json:"LogoParam,omitnil,omitempty" name:"LogoParam"`

	// Image return method (base64 or url).
	// You can specify only one method. Default value: base64.
	// The URL is valid for 1 hour.
	// It is recommended to choose url when the generated image resolution is large. Using base64 may cause return failure due to the image being too large.
	RspImgType *string `json:"RspImgType,omitnil,omitempty" name:"RspImgType"`
}

func (r *ChangeClothesRequest) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *ChangeClothesRequest) FromJsonString(s string) error {
	f := make(map[string]interface{})
	if err := json.Unmarshal([]byte(s), &f); err != nil {
		return err
	}
	delete(f, "ModelUrl")
	delete(f, "ClothesUrl")
	delete(f, "ClothesType")
	delete(f, "LogoAdd")
	delete(f, "LogoParam")
	delete(f, "RspImgType")
	if len(f) > 0 {
		return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ChangeClothesRequest has unknown keys!", "")
	}
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type ChangeClothesResponseParams struct {
	// Different content is returned depending on the input parameter RspImgType.
	// If the value is base64, the Base64 code of the generated image is returned.
	// If the value is url, the URL of the generated image is returned. The URL is valid for 1 hour. Save it in time.
	ResultImage *string `json:"ResultImage,omitnil,omitempty" name:"ResultImage"`

	// The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
	RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
}

type ChangeClothesResponse struct {
	*tchttp.BaseResponse
	Response *ChangeClothesResponseParams `json:"Response"`
}

func (r *ChangeClothesResponse) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *ChangeClothesResponse) FromJsonString(s string) error {
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type ImageToImageRequestParams struct {
	// Base64 code of the input mage.
	// Either the Base64 code or URL must be provided. If both are provided, URL prevails.
	// Image restrictions: The single-edge resolution must be less than 5,000 and greater than 50, and the size after Base64 encoding must be less than 8 MB. Supported formats include JPG, JPEG, PNG, BMP, TIFF and WEBP.
	InputImage *string `json:"InputImage,omitnil,omitempty" name:"InputImage"`

	// URL of the input mage.
	// Either the Base64 code or URL must be provided. If both are provided, URL prevails.
	// Image restrictions: The single-edge resolution must be less than 5,000 and greater than 50, and the size after Base64 encoding must be less than 8 MB. Supported formats include JPG, JPEG, PNG, BMP, TIFF and WEBP.
	InputUrl *string `json:"InputUrl,omitnil,omitempty" name:"InputUrl"`

	// Text description.
	// It is used to increase the possibility that the generation result contains the described content.
	// A maximum of 256 UTF-8 characters are supported.
	Prompt *string `json:"Prompt,omitnil,omitempty" name:"Prompt"`

	// Negative text description.
	// It is used to reduce the possibility that the generation result contains the described content, but such content cannot be completely avoided.
	// English is recommended. A maximum of 256 UTF-8 characters are supported.
	NegativePrompt *string `json:"NegativePrompt,omitnil,omitempty" name:"NegativePrompt"`

	// Image style.
	// Select the desired style from the [Image Style List](https://intl.cloud.tencent.com/document/product/1668/86250?from_cn_redirect=1) and enter the style number.
	// It is recommended to use only one style. If no style is specified, 201 (anime style) is used by default.
	Styles []*string `json:"Styles,omitnil,omitempty" name:"Styles"`

	// Configurations of the generated image, including the resolution.
	// Images with the following resolutions can be generated: origin (The resolution is the same as the input image resolution, with the edge resolution of up to 2000. The image will be zoomed out proportionally if the resolution is exceeded.), 768:768 (1:1), 768:1024 (3:4), and 1024:768 (4:3).
	// If the resolution is not specified, origin is used by default.
	ResultConfig *ResultConfig `json:"ResultConfig,omitnil,omitempty" name:"ResultConfig"`

	// Switch indicating whether to add a logo to the generated image. Default value: 1.
	// 1: add logo
	// 0: do not add logo
	// Other values: add logo
	// It is recommended to use an obvious logo to indicate that the image result is generated by AI.
	LogoAdd *int64 `json:"LogoAdd,omitnil,omitempty" name:"LogoAdd"`

	// Logo content settings.
	// By default, the text "Generated by AI" is added to the bottom right corner of the generated image. You can also use other logo.
	LogoParam *LogoParam `json:"LogoParam,omitnil,omitempty" name:"LogoParam"`

	// Generation strength.
	// The smaller the strength value, the more the generated image resembles the original image. Value range: (0, 1]. If the strength is not specified, the default value of the model is used.
	// The recommended value range is 0.6 to 0.8.
	Strength *float64 `json:"Strength,omitnil,omitempty" name:"Strength"`

	// Image return method (base64 or url).
	// You can specify only one method. Default value: base64.
	// The URL is valid for 1 hour.
	RspImgType *string `json:"RspImgType,omitnil,omitempty" name:"RspImgType"`

	// Switch indicating whether to  enhance image clarity. Default value: 0.
	// 1: on
	// 0: off
	// If the switch is turned on, the image clarity will be enhanced and the generation time will increase.
	EnhanceImage *int64 `json:"EnhanceImage,omitnil,omitempty" name:"EnhanceImage"`

	// Maximum number of faces for detail restoration. Value range: 0 - 6. Default value: 0.
	// If the input value is greater than 0, the value will be used as the maximum number of faces with a small area can be restored in each image. The generation time will increase according to the actual number of faces restored.
	RestoreFace *int64 `json:"RestoreFace,omitnil,omitempty" name:"RestoreFace"`
}

type ImageToImageRequest struct {
	*tchttp.BaseRequest
	
	// Base64 code of the input mage.
	// Either the Base64 code or URL must be provided. If both are provided, URL prevails.
	// Image restrictions: The single-edge resolution must be less than 5,000 and greater than 50, and the size after Base64 encoding must be less than 8 MB. Supported formats include JPG, JPEG, PNG, BMP, TIFF and WEBP.
	InputImage *string `json:"InputImage,omitnil,omitempty" name:"InputImage"`

	// URL of the input mage.
	// Either the Base64 code or URL must be provided. If both are provided, URL prevails.
	// Image restrictions: The single-edge resolution must be less than 5,000 and greater than 50, and the size after Base64 encoding must be less than 8 MB. Supported formats include JPG, JPEG, PNG, BMP, TIFF and WEBP.
	InputUrl *string `json:"InputUrl,omitnil,omitempty" name:"InputUrl"`

	// Text description.
	// It is used to increase the possibility that the generation result contains the described content.
	// A maximum of 256 UTF-8 characters are supported.
	Prompt *string `json:"Prompt,omitnil,omitempty" name:"Prompt"`

	// Negative text description.
	// It is used to reduce the possibility that the generation result contains the described content, but such content cannot be completely avoided.
	// English is recommended. A maximum of 256 UTF-8 characters are supported.
	NegativePrompt *string `json:"NegativePrompt,omitnil,omitempty" name:"NegativePrompt"`

	// Image style.
	// Select the desired style from the [Image Style List](https://intl.cloud.tencent.com/document/product/1668/86250?from_cn_redirect=1) and enter the style number.
	// It is recommended to use only one style. If no style is specified, 201 (anime style) is used by default.
	Styles []*string `json:"Styles,omitnil,omitempty" name:"Styles"`

	// Configurations of the generated image, including the resolution.
	// Images with the following resolutions can be generated: origin (The resolution is the same as the input image resolution, with the edge resolution of up to 2000. The image will be zoomed out proportionally if the resolution is exceeded.), 768:768 (1:1), 768:1024 (3:4), and 1024:768 (4:3).
	// If the resolution is not specified, origin is used by default.
	ResultConfig *ResultConfig `json:"ResultConfig,omitnil,omitempty" name:"ResultConfig"`

	// Switch indicating whether to add a logo to the generated image. Default value: 1.
	// 1: add logo
	// 0: do not add logo
	// Other values: add logo
	// It is recommended to use an obvious logo to indicate that the image result is generated by AI.
	LogoAdd *int64 `json:"LogoAdd,omitnil,omitempty" name:"LogoAdd"`

	// Logo content settings.
	// By default, the text "Generated by AI" is added to the bottom right corner of the generated image. You can also use other logo.
	LogoParam *LogoParam `json:"LogoParam,omitnil,omitempty" name:"LogoParam"`

	// Generation strength.
	// The smaller the strength value, the more the generated image resembles the original image. Value range: (0, 1]. If the strength is not specified, the default value of the model is used.
	// The recommended value range is 0.6 to 0.8.
	Strength *float64 `json:"Strength,omitnil,omitempty" name:"Strength"`

	// Image return method (base64 or url).
	// You can specify only one method. Default value: base64.
	// The URL is valid for 1 hour.
	RspImgType *string `json:"RspImgType,omitnil,omitempty" name:"RspImgType"`

	// Switch indicating whether to  enhance image clarity. Default value: 0.
	// 1: on
	// 0: off
	// If the switch is turned on, the image clarity will be enhanced and the generation time will increase.
	EnhanceImage *int64 `json:"EnhanceImage,omitnil,omitempty" name:"EnhanceImage"`

	// Maximum number of faces for detail restoration. Value range: 0 - 6. Default value: 0.
	// If the input value is greater than 0, the value will be used as the maximum number of faces with a small area can be restored in each image. The generation time will increase according to the actual number of faces restored.
	RestoreFace *int64 `json:"RestoreFace,omitnil,omitempty" name:"RestoreFace"`
}

func (r *ImageToImageRequest) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *ImageToImageRequest) FromJsonString(s string) error {
	f := make(map[string]interface{})
	if err := json.Unmarshal([]byte(s), &f); err != nil {
		return err
	}
	delete(f, "InputImage")
	delete(f, "InputUrl")
	delete(f, "Prompt")
	delete(f, "NegativePrompt")
	delete(f, "Styles")
	delete(f, "ResultConfig")
	delete(f, "LogoAdd")
	delete(f, "LogoParam")
	delete(f, "Strength")
	delete(f, "RspImgType")
	delete(f, "EnhanceImage")
	delete(f, "RestoreFace")
	if len(f) > 0 {
		return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ImageToImageRequest has unknown keys!", "")
	}
	return json.Unmarshal([]byte(s), &r)
}

// Predefined struct for user
type ImageToImageResponseParams struct {
	// Different content is returned depending on the input parameter RspImgType.
	// If the value is base64, the Base64 code of the generated image is returned.
	// If the value is url, the URL of the generated image is returned. The URL is valid for 1 hour. Save it in time.
	ResultImage *string `json:"ResultImage,omitnil,omitempty" name:"ResultImage"`

	// The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
	RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
}

type ImageToImageResponse struct {
	*tchttp.BaseResponse
	Response *ImageToImageResponseParams `json:"Response"`
}

func (r *ImageToImageResponse) ToJsonString() string {
    b, _ := json.Marshal(r)
    return string(b)
}

// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
func (r *ImageToImageResponse) FromJsonString(s string) error {
	return json.Unmarshal([]byte(s), &r)
}

type LogoParam struct {
	// Logo URL
	LogoUrl *string `json:"LogoUrl,omitnil,omitempty" name:"LogoUrl"`

	// Logo Base64 code. Either the Base64 code or URL must be provided. If both are provided, URL prevails.
	LogoImage *string `json:"LogoImage,omitnil,omitempty" name:"LogoImage"`

	// Coordinates of the logo image in the generated image. The logo image will be stretched according to the coordinates.
	LogoRect *LogoRect `json:"LogoRect,omitnil,omitempty" name:"LogoRect"`
}

type LogoRect struct {
	// X-axis coordinate of the upper left corner
	X *int64 `json:"X,omitnil,omitempty" name:"X"`

	// Y-axis coordinate of the upper left corner
	Y *int64 `json:"Y,omitnil,omitempty" name:"Y"`

	// Box width
	Width *int64 `json:"Width,omitnil,omitempty" name:"Width"`

	// Box height
	Height *int64 `json:"Height,omitnil,omitempty" name:"Height"`
}

type ResultConfig struct {
	// Generated image resolution.
	// 
	// Images with the following resolutions can be generated: origin (The resolution is the same as the input image resolution, with the edge resolution of up to 2000. The image will be zoomed out proportionally if the resolution is exceeded.), 768:768 (1:1), 768:1024 (3:4), and 1024:768 (4:3). If the resolution is not specified, origin is used by default. The generated image may be cropped if the aspect ratio of the generated image is too different from that of the input image.
	Resolution *string `json:"Resolution,omitnil,omitempty" name:"Resolution"`
}