import { Company, CompanyType, CompanyStatus } from '../entities/company.entity';
import { ResponseExternalProfileDto } from './response-external-profile.dto';

export class ResponseCompanyDto {
  id: string;
  name: string;
  type: CompanyType;
  status: CompanyStatus;
  tin: string;
  vatNumber?: string | null;
  businessLicense?: string | null;
  fanNumber?: string | null;
  country: string;
  address?: string | null;
  phone?: string | null;
  email?: string | null;
  website?: string | null;
  attributes?: Record<string, any> | null;
  profiles?: ResponseExternalProfileDto[];
  createdAt: Date;
  updatedAt: Date;

  constructor(company: Company) {
    this.id = company.id;
    this.name = company.name;
    this.type = company.type;
    this.status = company.status;
    this.tin = company.tin;
    this.vatNumber = company.vatNumber;
    this.businessLicense = company.businessLicense;
    this.fanNumber = company.fanNumber;
    this.country = company.country;
    this.address = company.address;
    this.phone = company.phone;
    this.email = company.email;
    this.website = company.website;
    this.attributes = company.attributes;
    this.profiles = company.profiles?.map((p) => new ResponseExternalProfileDto(p));
    this.createdAt = company.createdAt;
    this.updatedAt = company.updatedAt;
  }
}
