package entity

import (
	"time"
)

type OrganizationType struct {
	ID          int64     `json:"-"`
	Name        string    `json:"name"`
	Key         string    `json:"key"`
	Description string    `json:"desc"`
	Created     time.Time `json:"created"`
	Updated     time.Time `json:"updated"`
}

type Organization struct {
	ID          int64                 `json:"-"`
	UUID        string                `json:"id"`
	Type        OrganizationType      `json:"type"`
	Name        string                `json:"name"`
	Description string                `json:"desc"`
	ReferenceID int64                 `json:"-"`
	ParentID    int64                 `json:"-"`
	Main        bool                  `json:"main"`
	Created     time.Time             `json:"created"`
	Updated     time.Time             `json:"updated"`
	Active      bool                  `json:"active"`
	Blocked     bool                  `json:"blocked"`
	Suspended   bool                  `json:"suspended"`
	Author      User                  `json:"author"`
	LastEditor  User                  `json:"last_editor"`
	Contacts    []OrganizationContact `json:"contacts"`
	Addresses   []OrganizationAddress `json:"addresses"`
	ChildOrgs   []Organization        `json:"childs"`
	Parent      *Organization         `json:"parent"`
}

type OrganizationContact struct {
	ID           int64         `json:"-"`
	UUID         string        `json:"id"`
	Organization *Organization `json:"organization"`
	Type         ContactType   `json:"type"`
	Contact      string        `json:"contact"`
	Name         string        `json:"name"`
	Description  string        `json:"desc"`
	Created      time.Time     `json:"created"`
	CreatedUser  User          `json:"author"`
	Updated      time.Time     `json:"updated"`
	UpdatedUser  User          `json:"last_editor"`
	Active       bool          `json:"active"`
}

type OrganizationAddress struct {
	ID           int64         `json:"-"`
	UUID         string        `json:"id"`
	Organization *Organization `json:"organization"`
	InternalID   string        `json:"internal_id"`
	Name         string        `json:"name"`
	Address      string        `json:"address"`
	Description  string        `json:"desc"`
	Latitude     float64       `json:"lat"`
	Longitude    float64       `json:"long"`
	Created      time.Time     `json:"created"`
	CreatedUser  User          `json:"author"`
	Updated      time.Time     `json:"updated"`
	UpdatedUser  User          `json:"last_editor"`
	Active       bool          `json:"active"`
}
