// Copyright 2026 MarketAlly. All rights reserved.
// SPDX-License-Identifier: MIT

package structs

import "time"

// PagesConfig represents the pages configuration for a repository
type PagesConfig struct {
	Enabled   bool   `json:"enabled"`
	Template  string `json:"template"`
	Subdomain string `json:"subdomain,omitempty"`
	URL       string `json:"url,omitempty"`
}

// PagesDomain represents a custom domain for Gitea Pages
type PagesDomain struct {
	ID                int64     `json:"id"`
	Domain            string    `json:"domain"`
	Verified          bool      `json:"verified"`
	VerificationToken string    `json:"verification_token,omitempty"`
	SSLStatus         string    `json:"ssl_status"`
	SSLCertExpiry     time.Time `json:"ssl_cert_expiry,omitzero"`
	Created           time.Time `json:"created_at"`
	VerifiedAt        time.Time `json:"verified_at,omitzero"`
}

// CreatePagesConfigOption options for creating/updating pages config
type CreatePagesConfigOption struct {
	// Whether pages is enabled
	Enabled bool `json:"enabled"`
	// Template to use (simple, documentation, product, portfolio)
	Template string `json:"template" binding:"In(simple,documentation,product,portfolio)"`
}

// AddPagesDomainOption options for adding a custom domain
type AddPagesDomainOption struct {
	// The custom domain to add
	// required: true
	Domain string `json:"domain" binding:"Required"`
	// Mark SSL as handled externally (e.g., by Cloudflare)
	SSLExternal bool `json:"ssl_external"`
}

// PagesInfo represents the full pages information for a repository
type PagesInfo struct {
	Config  *PagesConfig   `json:"config"`
	Domains []*PagesDomain `json:"domains,omitempty"`
}
