import { Type } from "class-transformer";
import { IsBoolean, IsInt, IsOptional, IsString } from "class-validator";

export class DeliveryAddress {
    @IsString() address: string;
    @IsString() department: string;
    @IsString() shortDescription: string;
    @IsString() description: string;
}

export class TicketHistory {
    @Type(() => Ticket) ticket: Ticket[];
}

export class Message {
    @IsString() attachment: string;
    @IsString() comment: string;
    @IsString() createdBy: string;
    @IsString() createdAt: string;
}

export class Service {
    @IsString() serviceType: string;
    @IsString() shortDescription: string;
    @Type(() => Number) price: number;
    @IsBoolean() status: boolean;
}

export class Device {
    @IsString() name: string;
    @IsString() model: string;
    @IsString() category: string;
    @IsString() sku: string;
    @IsString() sn: string;
    @IsString() gponSn: string;
    @IsString() @IsOptional() mac?: string;
    @IsString() @IsOptional() wifiPass?: string;
    @IsString() @IsOptional() tag?: string;
    @IsString() room: string;
    @Type(() => Number) price: number;
    @IsString() @IsOptional() speed?: string;
    @IsString() description: string;
}

export class Contact {
    @IsString() FirstName: string;
    @IsString() LastName: string;
    @IsString() @IsOptional() telHome?: string;
    @IsString() @IsOptional() telOffice?: string;
    @IsString() @IsOptional() telOfficeExt?: string;
    @IsString() @IsOptional() cell?: string;
    @IsString() @IsOptional() fax?: string;
    @IsString() email: string;
}

export class Ticket {
    @IsInt() id: number;
    @IsString() createdAt: string;
    @Type(() => DeliveryAddress) deliveryAddress: DeliveryAddress;
    @Type(() => Message) message: Message[];
    @Type(() => Service) service: Service[];
    @Type(() => Device) device: Device[];
    @Type(() => Contact) contact: Contact[];
    @Type(() => TicketHistory) TicketHistory: TicketHistory;
}


export const sortOrders: string[] = ['id', 'status', 'assign_to', 'address1', 'subject', 'dept_id', 'parent', 'due_date', 'last_update', 'date_closed'];
export const sortTypes: string[] = ['ASC', 'DESC'];