package models

import (
	"time"

	"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/proto/broker"
)

type Tariff struct {
	ID         string      `json:"_id"`
	Name       string      `json:"name"`
	Price      uint64      `json:"price,omitempty"`
	IsCustom   bool        `json:"isCustom"`
	Privileges []Privilege `json:"privileges"`
	Deleted    bool        `json:"isDeleted"`
	CreatedAt  time.Time   `json:"createdAt"`
	UpdatedAt  time.Time   `json:"updatedAt"`
	DeletedAt  *time.Time  `json:"deletedAt,omitempty"`
}

type Privilege struct {
	ID          string        `json:"_id"`
	Name        string        `json:"name"`
	PrivilegeID string        `json:"privilegeId"`
	ServiceKey  string        `json:"serviceKey"`
	Description string        `json:"description"`
	Amount      uint64        `json:"amount"`
	Type        PrivilegeType `json:"type"`
	Value       string        `json:"value"`
	Price       uint64        `json:"price"`
}

type PrivilegeType string

const (
	PrivilegeTypeCount = "count"
	PrivilegeTypeDay   = "day"
	PrivilegeTypeFull  = "full"
)

var (
	PrivilegeTypeMap = map[broker.PrivilegeType]PrivilegeType{
		broker.PrivilegeType_Full:  PrivilegeTypeFull,
		broker.PrivilegeType_Day:   PrivilegeTypeDay,
		broker.PrivilegeType_Count: PrivilegeTypeCount,
	}

	PrivilegeBrokerTypeMap = map[PrivilegeType]broker.PrivilegeType{
		PrivilegeTypeFull:  broker.PrivilegeType_Full,
		PrivilegeTypeDay:   broker.PrivilegeType_Day,
		PrivilegeTypeCount: broker.PrivilegeType_Count,
	}
)
