package model

import "time"

// GptAccount represents a ChatGPT Team account stored in the database.
type GptAccount struct {
	ID               int64     `json:"id"`
	Email            string    `json:"email"`
	Token            string    `json:"token"`
	RefreshToken     string    `json:"refresh_token"`
	UserCount        int       `json:"user_count"`
	InviteCount      int       `json:"invite_count"`
	ChatgptAccountID string    `json:"chatgpt_account_id"`
	OaiDeviceID      string    `json:"oai_device_id"`
	ExpireAt         string    `json:"expire_at"`
	IsOpen           bool      `json:"is_open"`
	IsBanned         bool      `json:"is_banned"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
}

// RedemptionCode represents a redemption code stored in the database.
type RedemptionCode struct {
	ID           int64     `json:"id"`
	Code         string    `json:"code"`
	IsRedeemed   bool      `json:"is_redeemed"`
	RedeemedAt   *string   `json:"redeemed_at"`
	RedeemedBy   *string   `json:"redeemed_by"`
	AccountEmail string    `json:"account_email"`
	Channel      string    `json:"channel"`
	CreatedAt    time.Time `json:"created_at"`
}

// TeamAccountInfo is the data returned from the ChatGPT accounts/check API.
type TeamAccountInfo struct {
	AccountID             string `json:"account_id"`
	Name                  string `json:"name"`
	PlanType              string `json:"plan_type"`
	ExpiresAt             string `json:"expires_at"`
	HasActiveSubscription bool   `json:"has_active_subscription"`
}

// ChatGPTUser represents a team member returned from the users API.
type ChatGPTUser struct {
	ID            string `json:"id"`
	AccountUserID string `json:"account_user_id"`
	Email         string `json:"email"`
	Role          string `json:"role"`
	Name          string `json:"name"`
}

// ChatGPTInvite represents a pending invite returned from the invites API.
type ChatGPTInvite struct {
	ID           string `json:"id"`
	EmailAddress string `json:"email_address"`
	Role         string `json:"role"`
}

// TelegramAdmin represents a Telegram admin user stored in the database.
type TelegramAdmin struct {
	ID        int64     `json:"id"`
	UserID    int64     `json:"user_id"`
	AddedBy   int64     `json:"added_by"`
	CreatedAt time.Time `json:"created_at"`
}
