import { ObjectType, Field, ID } from '@nestjs/graphql';
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document, Types } from 'mongoose';
import { Base } from '@/models/base.model';

@ObjectType()
@Schema({ timestamps: true })
export class Company extends Base {

    @Field(() => ID)
    readonly _id: string;

    @Field()
    @Prop({ required: true })
    formal_name: string;

    @Field()
    @Prop({ required: true })
    company_type: string;

    @Field()
    @Prop({ required: true })
    commercial_type: string;

    @Field()
    @Prop({ required: true })
    tax_no: string;

    @Field()
    @Prop({ required: true })
    public_name: string;

    @Field()
    @Prop({ required: true })
    company_tag: string;

    @Field()
    @Prop({ required: true, default: 'TR' })
    default_lang_type: string;

    @Field()
    @Prop({ required: true, default: 'TL' })
    default_money_type: string;

    @Field()
    @Prop({ required: true, default: false })
    is_commercial: boolean;

    @Field()
    @Prop({ required: true, default: false })
    is_blacklist: boolean;

    @Field()
    @Prop({ required: false })
    parent_id: string;

    @Field()
    @Prop({ required: false })
    workplace_no: string;

    @Field()
    @Prop({ required: false })
    official_address: string;

    @Field()
    @Prop({ required: false })
    top_responsible_company: string;

}

export type CompanyDocument = Company & Document;
export const CompanySchema = SchemaFactory.createForClass(Company);
