package dto

import "github.com/google/go-github/v50/github"

type ListAuthorizedRepositoriesResp struct {
	BaseResp BaseResp            `json:"base_resp"`
	Data     []*GithubRepository `json:"data"`
}

type GithubRepository struct {
	FullName       *string           `json:"full_name"`
	Id             *int64            `json:"id"`
	InstallationId int64             `json:"installation_id"`
	Private        bool              `json:"private"`
	PushedAt       *github.Timestamp `json:"-"`
}

type ListBranchesResp struct {
	BaseResp BaseResp                  `json:"base_resp"`
	Data     []*GithubRepositoryBranch `json:"data"`
}

type GithubRepositoryBranch struct {
	Name      *string `json:"name"`
	Protected *bool   `json:"protected"`
}

type GetAuthorizeUrlResp struct {
	BaseResp BaseResp         `json:"base_resp"`
	Data     *GetAuthorizeUrl `json:"data"`
}

type GetAuthorizeUrl struct {
	Url                string `json:"url"`
	PreflightRequestId string `json:"preflight_request_id"`
}

type RepoBranchDirValidateReq struct {
	Branch    string `json:"branch"`
	Directory string `json:"directory"`
}

type RepoBranchDirValidateResp struct {
	BaseResp BaseResp                     `json:"base_resp"`
	Data     *RepoBranchDirValidateResult `json:"data"`
}

type RepoBranchDirValidateResult struct {
	Conflict      bool   `json:"conflict"`
	ExternalAppID string `json:"external_app_id"`
}

type GithubLinkageStatusResp struct {
	BaseResp BaseResp                   `json:"base_resp"`
	Data     *GithubLinkageStatusResult `json:"data"`
}

type GithubLinkageStatusResult struct {
	Authorized       bool   `json:"authorized"`
	InstallationId   int64  `json:"installation_id"`
	RepoId           int64  `json:"repository_id"`
	RepoFullName     string `json:"repository_full_name"`
	Branch           string `json:"branch"`
	Directory        string `json:"directory"`
	EnableAutoDeploy bool   `json:"enable_automatic_deployment"`
}
