package message

import (
	"errors"

	regionalapiv1 "github.com/tidbcloud/infra-provider/api/tidbcloud/regional-server/v1"
)

type CreatePrivateLinkServiceMigrationReqValidatable struct {
	*regionalapiv1.CreatePrivateLinkServiceMigrationRequest
}

func (c *CreatePrivateLinkServiceMigrationReqValidatable) Validate() error {
	if c == nil {
		return errors.New("request is nil")
	}
	if c.PrivateLinkServiceMigration.Id == "" {
		return errors.New("PrivateLinkServiceMigration.Id is empty")
	}
	if c.PrivateLinkServiceMigration == nil {
		return errors.New("PrivateLinkServiceMigration is nil")
	}
	if c.PrivateLinkServiceMigration.ClusterId == "" {
		return errors.New("PrivateLinkServiceMigration.ClusterId is empty")
	}
	if c.PrivateLinkServiceMigration.TidbGroupId == "" {
		return errors.New("PrivateLinkServiceMigration.TidbGroupId is empty")
	}
	if c.PrivateLinkServiceMigration.TargetClusterId == "" {
		return errors.New("PrivateLinkServiceMigration.TargetClusterId is empty")
	}
	if c.PrivateLinkServiceMigration.TargetTidbGroupId == "" {
		return errors.New("PrivateLinkServiceMigration.TargetTidbGroupId is empty")
	}
	if c.PrivateLinkServiceMigration.ProjectId == "" {
		return errors.New("PrivateLinkServiceMigration.ProjectId is empty")
	}
	return nil
}

type GetPrivateLinkServiceMigrationReqValidatable struct {
	*regionalapiv1.GetPrivateLinkServiceMigrationRequest
}

func (c *GetPrivateLinkServiceMigrationReqValidatable) Validate() error {
	if c == nil {
		return errors.New("request is nil")
	}
	if c.Id == "" {
		return errors.New("id is empty")
	}
	return nil
}

type ListPrivateLinkServiceMigrationsReqValidatable struct {
	*regionalapiv1.ListPrivateLinkServiceMigrationsRequest
}

func (c *ListPrivateLinkServiceMigrationsReqValidatable) Validate() error {
	if c == nil {
		return errors.New("request is nil")
	}
	if c.ProjectId == "" {
		return errors.New("projectId is empty")
	}
	return nil
}
