// Code generated by ent, DO NOT EDIT.

package migrate

import (
	"entgo.io/ent/dialect/entsql"
	"entgo.io/ent/dialect/sql/schema"
	"entgo.io/ent/schema/field"
)

var (
	// OrderStateLogsColumns holds the columns for the "order_state_logs" table.
	OrderStateLogsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "order_id", Type: field.TypeInt64},
		{Name: "from_status", Type: field.TypeString, Nullable: true, Size: 30},
		{Name: "to_status", Type: field.TypeString, Size: 30},
		{Name: "action", Type: field.TypeString, Size: 50},
		{Name: "actor_id", Type: field.TypeInt64},
		{Name: "actor_role", Type: field.TypeString, Size: 20},
		{Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
		{Name: "created_at", Type: field.TypeTime},
	}
	// OrderStateLogsTable holds the schema information for the "order_state_logs" table.
	OrderStateLogsTable = &schema.Table{
		Name:       "order_state_logs",
		Columns:    OrderStateLogsColumns,
		PrimaryKey: []*schema.Column{OrderStateLogsColumns[0]},
	}
	// OrdersColumns holds the columns for the "orders" table.
	OrdersColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt64, Increment: true},
		{Name: "consumer_id", Type: field.TypeInt64},
		{Name: "player_id", Type: field.TypeInt64},
		{Name: "shop_id", Type: field.TypeInt64, Nullable: true},
		{Name: "service_snapshot", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}},
		{Name: "status", Type: field.TypeString, Size: 30, Default: "pending_payment"},
		{Name: "total_price", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "decimal(10,2)"}},
		{Name: "note", Type: field.TypeString, Nullable: true},
		{Name: "version", Type: field.TypeInt, Default: 1},
		{Name: "timeout_job_id", Type: field.TypeString, Nullable: true, Size: 100},
		{Name: "search_text", Type: field.TypeString, Nullable: true},
		{Name: "created_at", Type: field.TypeTime},
		{Name: "accepted_at", Type: field.TypeTime, Nullable: true},
		{Name: "closed_at", Type: field.TypeTime, Nullable: true},
		{Name: "completed_at", Type: field.TypeTime, Nullable: true},
		{Name: "cancelled_at", Type: field.TypeTime, Nullable: true},
		{Name: "updated_at", Type: field.TypeTime},
	}
	// OrdersTable holds the schema information for the "orders" table.
	OrdersTable = &schema.Table{
		Name:       "orders",
		Columns:    OrdersColumns,
		PrimaryKey: []*schema.Column{OrdersColumns[0]},
	}
	// Tables holds all the tables in the schema.
	Tables = []*schema.Table{
		OrderStateLogsTable,
		OrdersTable,
	}
)

func init() {
	OrderStateLogsTable.Annotation = &entsql.Annotation{
		Table: "order_state_logs",
	}
	OrdersTable.Annotation = &entsql.Annotation{
		Table: "orders",
	}
	OrdersTable.Annotation.Checks = map[string]string{
		"chk_order_status":   "status IN ('pending_payment', 'pending_accept', 'in_progress', 'pending_close', 'pending_review', 'disputed', 'completed', 'cancelled')",
		"chk_price_positive": "total_price > 0",
	}
}
